import path from 'node:path';

import vue from '@vitejs/plugin-vue';
import vueJsx from '@vitejs/plugin-vue-jsx';

import createUnoCss from './unocss';
import createAutoImport from './auto-import';
import createComponents from './components';
import createCompression from './compression';
import createSetupExtend from './setup-extend';
import createI18n from './i18n';
import createCheck from './checker';
import { configSvgIconsPlugin } from './svg-sprite';

export default (viteEnv: any, _isBuild = false): [] => {
  const vitePlugins: any = [];
  vitePlugins.push(vue());
  vitePlugins.push(vueJsx());
  vitePlugins.push(createUnoCss());
  vitePlugins.push(createAutoImport(path));
  vitePlugins.push(createComponents(path));
  vitePlugins.push(createCompression(viteEnv));
  vitePlugins.push(createSetupExtend());
  vitePlugins.push(createI18n(path));
  vitePlugins.push(createCheck());
  vitePlugins.push(configSvgIconsPlugin());
  return vitePlugins;
};
